# -*- coding:utf-8 -*-
import requests
import json

url = "http://www.xinfadi.com.cn/getPriceData.html"

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
}


for num in range(1, 4):
    data = {
        "limit": "10",
        "current": str(num),
        "pubDateStartTime": "",
        "pubDateEndTime": "",
        "prodPcatid": "",
        "prodCatid": "",
        "prodName": ""
    }
    resp = requests.post(url, headers=headers, data=data)
    dict_data = json.loads(resp.text)["list"]
    for data in dict_data:
        # print(data)
        print(f"菜的编号: {data['id']}, 菜名: {data['prodName']},平均价: {data['avgPrice']}，产地: {data['place']}")
        